emunsing commited on
Commit
f07250b
·
1 Parent(s): ed23888

Split into app.py for HF spaces

Browse files
Files changed (4) hide show
  1. .gitignore +28 -0
  2. __init__.py +0 -0
  3. app.py +15 -0
  4. eventbrite_summarizer.py +1 -14
.gitignore ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # General
2
+ .DS_Store
3
+ .AppleDouble
4
+ .LSOverride
5
+
6
+ __pycache__/
7
+
8
+ # Icon must end with two \r
9
+ Icon
10
+
11
+ # Thumbnails
12
+ ._*
13
+
14
+ # Files that might appear in the root of a volume
15
+ .DocumentRevisions-V100
16
+ .fseventsd
17
+ .Spotlight-V100
18
+ .TemporaryItems
19
+ .Trashes
20
+ .VolumeIcon.icns
21
+ .com.apple.timemachine.donotpresent
22
+
23
+ # Directories potentially created on remote AFP share
24
+ .AppleDB
25
+ .AppleDesktop
26
+ Network Trash Folder
27
+ Temporary Items
28
+ .apdisk
__init__.py ADDED
File without changes
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from eventbrite_summarizer import get_eventbrite_summary
2
+ import gradio as gr
3
+
4
+ top_level_prompt_stub = """You are a journalist writing a calendar of events, and need to create succinct, fun, and energizing summaries of events in 1-2 sentences. You will be given a description of an event you need to summarize; please respond with your brief, fun, and engaging summary."""
5
+
6
+
7
+ prompt_textbox = gr.Textbox(value=top_level_prompt_stub)
8
+ url_textbox = gr.Textbox(value='https://www.eventbrite.com/e/greenermind-summit-2023-tickets-576308392917',
9
+ placeholder='full eventbrite url')
10
+
11
+ demo = gr.Interface(fn=get_eventbrite_summary,
12
+ inputs=[url_textbox, prompt_textbox],
13
+ outputs=['text']
14
+ )
15
+ demo.launch()
eventbrite_summarizer.py CHANGED
@@ -5,7 +5,7 @@ import os
5
 
6
  from langchain.llms import OpenAI
7
  from langchain.prompts import PromptTemplate
8
- import gradio as gr
9
 
10
  EVENTBRITE_API_KEY = os.environ['EVENTBRITE_API_KEY']
11
 
@@ -73,16 +73,3 @@ def get_eventbrite_summary(event_url, top_level_prompt_stub):
73
  llm = OpenAI(model_name=openai_modeltype, temperature=temperature)
74
  res = llm(chat_prompt.to_messages()[0].content)
75
  return res.strip()
76
-
77
- top_level_prompt_stub = """You are a journalist writing a calendar of events, and need to create succinct, fun, and energizing summaries of events in 1-2 sentences. You will be given a description of an event you need to summarize; please respond with your brief, fun, and engaging summary."""
78
-
79
-
80
- prompt_textbox = gr.Textbox(value=top_level_prompt_stub)
81
- url_textbox = gr.Textbox(value='https://www.eventbrite.com/e/greenermind-summit-2023-tickets-576308392917',
82
- placeholder='full eventbrite url')
83
-
84
- demo = gr.Interface(fn=get_eventbrite_summary,
85
- inputs=[url_textbox, prompt_textbox],
86
- outputs=['text']
87
- )
88
- demo.launch()
 
5
 
6
  from langchain.llms import OpenAI
7
  from langchain.prompts import PromptTemplate
8
+
9
 
10
  EVENTBRITE_API_KEY = os.environ['EVENTBRITE_API_KEY']
11
 
 
73
  llm = OpenAI(model_name=openai_modeltype, temperature=temperature)
74
  res = llm(chat_prompt.to_messages()[0].content)
75
  return res.strip()