Spaces:
Runtime error
Runtime error
gradio 4.3
Browse files
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 🐠
|
|
4 |
colorFrom: green
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
4 |
colorFrom: green
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.7.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
app.py
CHANGED
@@ -22,14 +22,18 @@ def respond(message, history):
|
|
22 |
'Authorization': f'Bearer {local_token}'
|
23 |
}
|
24 |
|
25 |
-
prompt = list(itertools.chain.from_iterable(history))
|
26 |
-
prompt.append(message)
|
27 |
-
q = {"inputs": [prompt]}
|
|
|
28 |
try:
|
29 |
response = requests.post(
|
30 |
local_endpoint, json=q, headers=headers, timeout=100)
|
31 |
-
response_data = response.json(
|
32 |
-
)
|
|
|
|
|
|
|
33 |
except Exception as error:
|
34 |
response_data = f"ERROR status_code: {type(error).__name__}"
|
35 |
# + str(response.status_code) + " response:" + response.text
|
|
|
22 |
'Authorization': f'Bearer {local_token}'
|
23 |
}
|
24 |
|
25 |
+
#prompt = list(itertools.chain.from_iterable(history))
|
26 |
+
#prompt.append(message)
|
27 |
+
#q = {"inputs": [prompt]}
|
28 |
+
q = {"inputs": [message]}
|
29 |
try:
|
30 |
response = requests.post(
|
31 |
local_endpoint, json=q, headers=headers, timeout=100)
|
32 |
+
response_data = response.json()
|
33 |
+
#print(response_data)
|
34 |
+
response_data=response_data["predictions"][0]
|
35 |
+
#print(response_data)
|
36 |
+
|
37 |
except Exception as error:
|
38 |
response_data = f"ERROR status_code: {type(error).__name__}"
|
39 |
# + str(response.status_code) + " response:" + response.text
|