rodrigomasini
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -192,22 +192,51 @@ def display(x, y):
|
|
192 |
return subset_df
|
193 |
|
194 |
INTRODUCTION_TEXT = """
|
195 |
-
This is a copied space from
|
196 |
-
the results as table
|
197 |
-
the full leaderboard data easily.
|
198 |
-
|
199 |
```python
|
|
|
200 |
from gradio_client import Client
|
201 |
-
|
202 |
-
client
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
#
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
```
|
212 |
"""
|
213 |
|
|
|
192 |
return subset_df
|
193 |
|
194 |
INTRODUCTION_TEXT = """
|
195 |
+
This is a copied space from Enterprise Scenarios Leaderboard. Instead of displaying
|
196 |
+
the results as table this space was modified to simply provides a gradio API interface.
|
197 |
+
Using the following python script below, users can access the full leaderboard data easily.
|
198 |
+
Python on how to access the data:
|
199 |
```python
|
200 |
+
# Import dependencies
|
201 |
from gradio_client import Client
|
202 |
+
|
203 |
+
# Initialize the Gradio client with the API URL
|
204 |
+
client = Client("https://rodrigomasini-data-only-enterprise-scenarios-leaderboard.hf.space/")
|
205 |
+
|
206 |
+
try:
|
207 |
+
# Perform the API call
|
208 |
+
response = client.predict("","", api_name='/predict')
|
209 |
+
|
210 |
+
# Check if response it's directly accessible
|
211 |
+
if len(response) > 0:
|
212 |
+
print("Response received!")
|
213 |
+
headers = response.get('headers', [])
|
214 |
+
data = response.get('data', [])
|
215 |
+
|
216 |
+
print(headers)
|
217 |
+
|
218 |
+
# Remove commenst if you want to download the dataset and save in csv format
|
219 |
+
# Specify the path to your CSV file
|
220 |
+
#csv_file_path = 'enterprise-scenarios-benchmark.csv'
|
221 |
+
|
222 |
+
# Open the CSV file for writing
|
223 |
+
#with open(csv_file_path, mode='w', newline='', encoding='utf-8') as file:
|
224 |
+
# writer = csv.writer(file)
|
225 |
+
|
226 |
+
# Write the headers
|
227 |
+
# writer.writerow(headers)
|
228 |
+
|
229 |
+
# Write the data
|
230 |
+
# for row in data:
|
231 |
+
# writer.writerow(row)
|
232 |
+
|
233 |
+
#print(f"Results saved to {csv_file_path}")
|
234 |
+
|
235 |
+
# If the above line prints a string that looks like JSON, you can parse it with json.loads(response)
|
236 |
+
# Otherwise, you might need to adjust based on the actual structure of `response`
|
237 |
+
|
238 |
+
except Exception as e:
|
239 |
+
print(f"An error occurred: {e}")
|
240 |
```
|
241 |
"""
|
242 |
|