Spaces:
Running
Running
Update main.py
Browse files
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 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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")
|