Update app.py
Browse files
app.py
CHANGED
@@ -87,7 +87,14 @@ def bot(
|
|
87 |
"Please follow the instructions in the README to set it up.")
|
88 |
|
89 |
#text_prompt = chatbot[-1][0]
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
genai.configure(api_key=google_key)
|
92 |
generation_config = genai.types.GenerationConfig(
|
93 |
temperature=temperature,
|
@@ -97,9 +104,16 @@ def bot(
|
|
97 |
top_p=top_p)
|
98 |
|
99 |
if image_prompt is None:
|
|
|
100 |
model = genai.GenerativeModel('gemini-pro')
|
101 |
response = model.generate_content(
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
stream=True,
|
104 |
generation_config=generation_config)
|
105 |
response.resolve()
|
|
|
87 |
"Please follow the instructions in the README to set it up.")
|
88 |
|
89 |
#text_prompt = chatbot[-1][0]
|
90 |
+
txt_in = chatbot[-1][0]
|
91 |
+
if "youtube" in txt_in:
|
92 |
+
text_prompt = extract_text_from("https://www.youtube.com/watch?v=5Abk7EU5EJI")
|
93 |
+
else:
|
94 |
+
text_prompt = txt_in =
|
95 |
+
|
96 |
+
|
97 |
+
|
98 |
genai.configure(api_key=google_key)
|
99 |
generation_config = genai.types.GenerationConfig(
|
100 |
temperature=temperature,
|
|
|
104 |
top_p=top_p)
|
105 |
|
106 |
if image_prompt is None:
|
107 |
+
prompt= "استخرج كلمات مفتاحية من النص التالي: "+text_prompt
|
108 |
model = genai.GenerativeModel('gemini-pro')
|
109 |
response = model.generate_content(
|
110 |
+
prompt,
|
111 |
+
stream=True,
|
112 |
+
generation_config=generation_config)
|
113 |
+
out1 = response.text
|
114 |
+
prompt = "أذكر لي آية من القران الكريم تتحدث عن أحد هذه المواضيع او اكثر: "+ out1 + " واشرح الآيه وفسرها باللغة العربية."
|
115 |
+
response = model.generate_content(
|
116 |
+
prompt,
|
117 |
stream=True,
|
118 |
generation_config=generation_config)
|
119 |
response.resolve()
|