Tirath5504 commited on
Commit
fdcfa34
1 Parent(s): 08b85fe

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import google.generativeai as genai
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+ from langdetect import detect
5
+
6
+
7
+ api_key = "AIzaSyCmmus8HFPLXskU170_FR4j2CQeWZBKGMY"
8
+
9
+ model = genai.GenerativeModel('gemini-pro-vision')
10
+ genai.configure(api_key = api_key)
11
+
12
+ def pipeline(img):
13
+ try:
14
+ return score = model.generate_content(content=[f"Describe any damage (broken furniture, stains, etc.) in the given image. Also give the cost (in INR) for every damage sustained. Image: ", img])
15
+ except Exception:
16
+ return "No damage sustained"
17
+
18
+ iface = gr.Interface(
19
+ fn = pipeline,
20
+ inputs = gr.Image(label="Room Image", sources=['upload'], type="pil"),
21
+ outputs = ["text"]
22
+ )
23
+
24
+ iface.launch()