Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
3 |
|
4 |
def greet(name):
|
5 |
return "Hello " + name
|
@@ -7,6 +8,18 @@ def greet(name):
|
|
7 |
|
8 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
demo.launch()
|
11 |
'''
|
12 |
import requests
|
|
|
1 |
import gradio as gr
|
2 |
+
import requests
|
3 |
+
import os
|
4 |
|
5 |
def greet(name):
|
6 |
return "Hello " + name
|
|
|
8 |
|
9 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
10 |
|
11 |
+
|
12 |
+
token=os.getenv("HF_TOKEN", None)
|
13 |
+
headers = {"Authorization": f"Bearer {token}"}
|
14 |
+
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
|
15 |
+
def query(payload):
|
16 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
17 |
+
return response.json()
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
demo.launch()
|
24 |
'''
|
25 |
import requests
|