Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,11 +21,12 @@ def analyze_text(text):
|
|
21 |
if not text:
|
22 |
return "Please enter some text."
|
23 |
|
24 |
-
# Summarization using Gemini AI
|
25 |
try:
|
26 |
prompt = f"Summarize this text:\n{text}"
|
27 |
-
|
28 |
-
|
|
|
29 |
except Exception as e:
|
30 |
summary = f"Summarization failed: {str(e)}"
|
31 |
|
|
|
21 |
if not text:
|
22 |
return "Please enter some text."
|
23 |
|
24 |
+
# Summarization using Google Gemini AI
|
25 |
try:
|
26 |
prompt = f"Summarize this text:\n{text}"
|
27 |
+
model = genai.GenerativeModel("gemini-pro")
|
28 |
+
response = model.generate_content(prompt)
|
29 |
+
summary = response.text.strip() if response and hasattr(response, "text") else "Error in summarization."
|
30 |
except Exception as e:
|
31 |
summary = f"Summarization failed: {str(e)}"
|
32 |
|