MoAusaf commited on
Commit
6b46a71
1 Parent(s): ea0cd88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
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 greet(inputs) :
7
- greeting = "Hello " + inputs + "!"
 
 
 
 
 
8
 
9
- return greeting
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()