abdullah040 commited on
Commit
e873ee1
·
1 Parent(s): eebe7e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import re
3
  import textwrap
4
  import openai
5
  import gradio as gr
 
6
 
7
  def gpt3_completion(prompt, engine='text-davinci-002', temp=0.6, top_p=1.0, tokens=1000, freq_pen=0.25, pres_pen=0.0, stop=['<<END>>']):
8
  print("here");
@@ -59,7 +60,6 @@ def summarize_podcast(podcast):
59
  prompt = sp+"""\n
60
  Summarize the portion of the podcast. The summary should be around 200 words. use the Name instead of A, B, C...
61
  Podcast:
62
-
63
  """+str(chunk)+"""'\n\n"""
64
  summary = gpt3_completion(prompt)
65
  summary="chunk : "+str(count)+summary
@@ -67,6 +67,13 @@ def summarize_podcast(podcast):
67
  tempstr=tempstr+"\n"+summary
68
  return str(tempstr)
69
 
 
 
 
 
 
 
 
70
  input_file = gr.inputs.File(label="Upload your podcast in VTT format.")
71
 
72
  sample_url = "https://www.example.com/sample.vtt"
 
3
  import textwrap
4
  import openai
5
  import gradio as gr
6
+ from google.colab import files
7
 
8
  def gpt3_completion(prompt, engine='text-davinci-002', temp=0.6, top_p=1.0, tokens=1000, freq_pen=0.25, pres_pen=0.0, stop=['<<END>>']):
9
  print("here");
 
60
  prompt = sp+"""\n
61
  Summarize the portion of the podcast. The summary should be around 200 words. use the Name instead of A, B, C...
62
  Podcast:
 
63
  """+str(chunk)+"""'\n\n"""
64
  summary = gpt3_completion(prompt)
65
  summary="chunk : "+str(count)+summary
 
67
  tempstr=tempstr+"\n"+summary
68
  return str(tempstr)
69
 
70
+
71
+ uploaded = files.upload()
72
+
73
+ for filename in uploaded.keys():
74
+ print(f"User uploaded file with name '{filename}' and length {len(uploaded[filename])} bytes")
75
+ file_contents = uploaded[filename].decode('utf-8')
76
+
77
  input_file = gr.inputs.File(label="Upload your podcast in VTT format.")
78
 
79
  sample_url = "https://www.example.com/sample.vtt"