Gohil001 commited on
Commit
5949d48
·
verified ·
1 Parent(s): 7fe0573

requirements.txt

Browse files

gradio
requests

Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,18 +1,18 @@
1
  import gradio as gr
2
  import requests
3
 
4
- def call_api(input_text):
5
- # Google Cloud Run URL
6
  url = "https://hello-493710908743.us-central1.run.app"
7
- response = requests.post(url, json={"input": input_text})
8
  return response.text
9
 
10
  # Gradio Interface
11
  iface = gr.Interface(
12
- fn=call_api,
13
- inputs=gr.Textbox(label="Enter Input"),
14
- outputs=gr.Textbox(label="API Response"),
15
- title="Google Cloud Run App"
16
  )
17
 
18
  iface.launch()
 
1
  import gradio as gr
2
  import requests
3
 
4
+ def get_message():
5
+ # API URL (Cloud Run Service URL)
6
  url = "https://hello-493710908743.us-central1.run.app"
7
+ response = requests.get(url) # GET request
8
  return response.text
9
 
10
  # Gradio Interface
11
  iface = gr.Interface(
12
+ fn=get_message,
13
+ inputs=None,
14
+ outputs="text",
15
+ title="Cloud Run App Integration"
16
  )
17
 
18
  iface.launch()