Ujeshhh commited on
Commit
a42d2f6
·
verified ·
1 Parent(s): bbb3cf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -24,13 +24,14 @@ def analyze_text(text):
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
 
33
- # Basic Sentiment Analysis (Improve with ML if needed)
34
  sentiment = "Positive" if "good" in text.lower() else "Negative"
35
 
36
  # Keyword Extraction
 
24
  # Summarization using Google Gemini AI
25
  try:
26
  prompt = f"Summarize this text:\n{text}"
27
+ model = genai.GenerativeModel(model_name="gemini-pro")
28
+ response = model.generate_content([prompt]) # Ensure the prompt is passed as a list
29
+
30
  summary = response.text.strip() if response and hasattr(response, "text") else "Error in summarization."
31
  except Exception as e:
32
  summary = f"Summarization failed: {str(e)}"
33
 
34
+ # Basic Sentiment Analysis
35
  sentiment = "Positive" if "good" in text.lower() else "Negative"
36
 
37
  # Keyword Extraction