Spaces:
Build error
Build error
Commit
·
1108f7c
1
Parent(s):
87e16c7
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def get_random_file_from_s3(input_txt, api_key):
|
| 5 |
+
|
| 6 |
+
url = "http://18.189.132.140:5218/run/predict"
|
| 7 |
+
response = requests.post(
|
| 8 |
+
url=url,
|
| 9 |
+
json={
|
| 10 |
+
"data": [
|
| 11 |
+
"abcd",
|
| 12 |
+
"J4g7Bv9Tm0A3Q6yZ"
|
| 13 |
+
]
|
| 14 |
+
}
|
| 15 |
+
).json()
|
| 16 |
+
|
| 17 |
+
file_url = response["data"][0]
|
| 18 |
+
return file_url
|
| 19 |
+
|
| 20 |
+
gr.Interface(
|
| 21 |
+
get_random_file_from_s3,
|
| 22 |
+
inputs=[
|
| 23 |
+
"text",
|
| 24 |
+
"text"
|
| 25 |
+
],
|
| 26 |
+
outputs=["text"]
|
| 27 |
+
).launch()
|
| 28 |
+
|