Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from gradio_client import Client
|
2 |
+
|
3 |
+
client = Client("https://ayoubchlin-ayoubchlin-bart-mnli-cnn-news.hf.space/")
|
4 |
+
|
5 |
+
result = client.predict(
|
6 |
+
"Prior to the introduction of scopes, Dropbox API apps would select only their level of content access (described below). Business API apps would select from one of four permission types to determine the API calls they have access to:", # str representing input in 'Input' Textbox component
|
7 |
+
'politics,news,sports,tech,science', # str representing input in 'Possible class names (comma-separated)' Textbox component
|
8 |
+
False, # bool representing input in 'Allow multiple true classes' Checkbox component
|
9 |
+
api_name="/predict"
|
10 |
+
)
|
11 |
+
|
12 |
+
import json
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
# Open the file in read mode
|
17 |
+
with open(result, 'r') as file:
|
18 |
+
# Read the contents of the file
|
19 |
+
json_data = json.load(file)
|
20 |
+
|
21 |
+
# Do further processing with the JSON data
|
22 |
+
# For example, print the content of the JSON file
|
23 |
+
print(json_data["label"])
|