ammaan commited on
Commit
c2a5f95
·
verified ·
1 Parent(s): 0cc4145

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -2
main.py CHANGED
@@ -32,8 +32,15 @@ def get_youtube_transcript(video_url):
32
  return f"An error occurred: {e}"
33
 
34
  def summarize_text(text):
35
- summarized_text = text_summary(str(text))
36
- return summarized_text[0]['summary_text']
 
 
 
 
 
 
 
37
 
38
  # Get the input from the frontend
39
  @app.get("/getdata")
 
32
  return f"An error occurred: {e}"
33
 
34
  def summarize_text(text):
35
+ try:
36
+ # Convert the text to string if it's not already
37
+ text = str(text)
38
+ # Summarize the text
39
+ summarized_text = text_summary(text)
40
+ return summarized_text[0]['summary_text']
41
+ except Exception as e:
42
+ return f"An error occurred: {e}"
43
+
44
 
45
  # Get the input from the frontend
46
  @app.get("/getdata")