Rishit commited on
Commit
53a08fc
·
verified ·
1 Parent(s): c534696

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ API_URL = "https://ai-research.quarkgen.ai/templedekho/vastu/v1"
5
+
6
+ def get_vastu_advice(question, image):
7
+ image_file = {'image_path': image}
8
+ data = {'question': question}
9
+
10
+ response = requests.post(API_URL, files=image_file, data=data)
11
+
12
+ if response.status_code == 200:
13
+ return response.text
14
+ else:
15
+ return f"Error: {response.json()['error']}"
16
+
17
+ # Gradio interface
18
+ iface = gr.Interface(
19
+ fn=get_vastu_advice,
20
+ inputs=[
21
+ gr.Textbox(label="Question"),
22
+ gr.Image(type="file", label="Upload House Image (JPEG/PNG)")
23
+ ],
24
+ outputs=gr.Textbox(label="Vastu Prediction"),
25
+ title="AI Vastu Astrologer"
26
+ )
27
+
28
+ if __name__ == "__main__":
29
+ iface.launch()