abdullah040 commited on
Commit
fafbbfd
·
1 Parent(s): 058ac7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -21,11 +21,12 @@ def gpt3_completion(prompt, engine='text-davinci-002', temp=0.6, top_p=1.0, toke
21
  text = re.sub('\s+', ' ', text)
22
  return text
23
 
24
- def summarize_podcast(podcast):
25
  # Open the transcript file
26
  print("ayay hai")
27
- with open(podcast) as file:
28
- transcript = file.read()
 
29
  res = len(transcript.split())
30
 
31
  transcript = transcript.replace("WEBVTT", "")
@@ -66,12 +67,8 @@ def summarize_podcast(podcast):
66
  tempstr=tempstr+"\n"+summary
67
  return str(tempstr)
68
 
69
-
70
- input_file = gr.inputs.File(label="Upload your podcast in VTT format.")
71
-
72
- sample_url = "https://www.example.com/sample.vtt"
73
-
74
- iface = gr.Interface(fn=summarize_podcast, inputs=input_file, title="Podcast Summarizer", outputs="text",
75
- description="This tool summarizes a podcast in VTT format, providing a summary of each chunk of text.")
76
-
77
- iface.launch()
 
21
  text = re.sub('\s+', ' ', text)
22
  return text
23
 
24
+ def summarize_podcast(podcast_file):
25
  # Open the transcript file
26
  print("ayay hai")
27
+ with open(podcast_file.name, "r") as f:
28
+ # read the contents of the uploaded file
29
+ transcript = f.read()
30
  res = len(transcript.split())
31
 
32
  transcript = transcript.replace("WEBVTT", "")
 
67
  tempstr=tempstr+"\n"+summary
68
  return str(tempstr)
69
 
70
+ inputs = gr.inputs.File(label="Upload podcast file")
71
+ outputs = gr.outputs.Textbox(label="Summary")
72
+ title = "Podcast Summarizer"
73
+ description = "Summarize your podcast into a few key points using this app."
74
+ gr.Interface(fn=summarize_podcast, inputs=inputs, outputs=outputs, title=title, description=description).launch()