Rooni commited on
Commit
7995987
·
verified ·
1 Parent(s): f643627

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -62,7 +62,7 @@ def edit_story(original_story, edited_prompt):
62
  except Exception as e:
63
  return f"Ошибка редактирования: {e}"
64
 
65
- def next_story(original_story, edited_prompt=""):
66
  try:
67
  client = InferenceClient(api_key=get_random_api_key())
68
 
@@ -73,10 +73,10 @@ def next_story(original_story, edited_prompt=""):
73
  ]
74
 
75
  completion = client.chat.completions.create(model="Qwen/Qwen2.5-Coder-32B-Instruct", messages=messages, temperature=0.7, max_tokens=2500)
76
- edited_story = completion.choices[0].message.content
77
- return edited_story
78
  except Exception as e:
79
- return f"Ошибка редактирования: {e}"
80
 
81
  with gr.Blocks(css=css) as demo:
82
  with gr.Row():
@@ -97,7 +97,7 @@ with gr.Blocks(css=css) as demo:
97
 
98
  with gr.Tab("Продление"):
99
  next_prompt = gr.Textbox(label="Введите изменения для истории", placeholder="Например: Сделай историю более захватывающей", lines=5)
100
- next_story = gr.Textbox(label="Отредактированная история", lines=10)
101
  next_button = gr.Button("Продлить", variant='primary')
102
 
103
  generate_button.click(generate_story, inputs=[prompt, style], outputs=[output_story], concurrency_limit=250)
 
62
  except Exception as e:
63
  return f"Ошибка редактирования: {e}"
64
 
65
+ def next_story(original_story, next_prompt=""):
66
  try:
67
  client = InferenceClient(api_key=get_random_api_key())
68
 
 
73
  ]
74
 
75
  completion = client.chat.completions.create(model="Qwen/Qwen2.5-Coder-32B-Instruct", messages=messages, temperature=0.7, max_tokens=2500)
76
+ next_story = completion.choices[0].message.content
77
+ return next_story
78
  except Exception as e:
79
+ return f"Ошибка продления: {e}"
80
 
81
  with gr.Blocks(css=css) as demo:
82
  with gr.Row():
 
97
 
98
  with gr.Tab("Продление"):
99
  next_prompt = gr.Textbox(label="Введите изменения для истории", placeholder="Например: Сделай историю более захватывающей", lines=5)
100
+ next_story = gr.Textbox(label="Продолжение истории", lines=10)
101
  next_button = gr.Button("Продлить", variant='primary')
102
 
103
  generate_button.click(generate_story, inputs=[prompt, style], outputs=[output_story], concurrency_limit=250)