Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
-
from io import BytesIO
|
3 |
import requests
|
4 |
-
import json
|
5 |
|
6 |
-
def
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
12 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import requests
|
|
|
3 |
|
4 |
+
def upload_file(inputs):
|
5 |
+
file_data = inputs.read()
|
6 |
+
files = {"file": file_data}
|
7 |
+
response = requests.post("https://getprediction-o22v7v4baq-el.a.run.app/upload", files=files)
|
8 |
+
responsedata = response.json()
|
9 |
+
prediction = responsedata.get('prediction', 'Prediction not available')
|
10 |
+
return prediction
|
11 |
|
12 |
+
iface = gr.Interface(upload_file, inputs="file", outputs="text")
|
13 |
+
iface.launch()
|
|
|
|