wh1223 commited on
Commit
cbc3ef2
·
verified ·
1 Parent(s): a8a7b81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -10,9 +10,14 @@ def img2text(url):
10
 
11
  # text2story
12
  def text2story(text):
13
- story_text = "" # to be completed
 
 
 
 
 
14
  return story_text
15
-
16
  # text2audio
17
  def text2audio(story_text):
18
  audio_data = "" # to be completed
@@ -38,8 +43,8 @@ if uploaded_file is not None:
38
 
39
  #Stage 2: Text to Story
40
  st.text('Generating a story...')
41
- #story = text2story(scenario)
42
- #st.write(story)
43
 
44
  #Stage 3: Story to Audio data
45
  #st.text('Generating audio data...')
 
10
 
11
  # text2story
12
  def text2story(text):
13
+ #story_text = "" # to be completed
14
+ messages = [
15
+ {"role": "user", "content": "根据以下关键词生成一个100字的故事:"+text },
16
+ ]
17
+ text_to_story_model= pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True)
18
+ story_text = text_to_story_model(messages)
19
  return story_text
20
+
21
  # text2audio
22
  def text2audio(story_text):
23
  audio_data = "" # to be completed
 
43
 
44
  #Stage 2: Text to Story
45
  st.text('Generating a story...')
46
+ story = text2story(scenario)
47
+ st.write(story)
48
 
49
  #Stage 3: Story to Audio data
50
  #st.text('Generating audio data...')