asalhi85 commited on
Commit
0b6ccf2
1 Parent(s): d91454b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -147,6 +147,7 @@ def bot(
147
  response2.resolve()
148
 
149
  else:
 
150
  image_prompt = preprocess_image(image_prompt)
151
  model = genai.GenerativeModel('gemini-pro-vision')
152
  response = model.generate_content(
@@ -154,6 +155,28 @@ def bot(
154
  stream=True,
155
  generation_config=generation_config, safety_settings=safety_settings)
156
  response.resolve()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
  # streaming effect
159
  chatbot[-1][1] = ""
 
147
  response2.resolve()
148
 
149
  else:
150
+ prompt= "اكتب لي وصف عن الصورة المرفقة "
151
  image_prompt = preprocess_image(image_prompt)
152
  model = genai.GenerativeModel('gemini-pro-vision')
153
  response = model.generate_content(
 
155
  stream=True,
156
  generation_config=generation_config, safety_settings=safety_settings)
157
  response.resolve()
158
+ out1 = response.text
159
+
160
+ prompt= "استخرج كلمات مفتاحية من النص التالي: "+out1
161
+ model1 = genai.GenerativeModel('gemini-pro')
162
+ response1 = model1.generate_content(
163
+ prompt,
164
+ stream=True,
165
+ generation_config=generation_config,safety_settings=safety_settings)
166
+ response1.resolve()
167
+
168
+ out2 = response1.text
169
+
170
+ model2 = genai.GenerativeModel('gemini-pro')
171
+
172
+ prompt = "أذكر لي آية من القران الكريم تتحدث عن أحد هذه المواضيع او اكثر: "+ out2 + " واشرح الآيه وفسرها باللغة العربية."
173
+ response2 = model2.generate_content(
174
+ prompt,
175
+ stream=True,
176
+ generation_config=generation_config, safety_settings=safety_settings)
177
+ response2.resolve()
178
+
179
+
180
 
181
  # streaming effect
182
  chatbot[-1][1] = ""