LokasNori commited on
Commit
9f180a3
1 Parent(s): 7a438ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -18
app.py CHANGED
@@ -35,22 +35,16 @@ def run_inference(prompt, config):
35
  print(f"Inference finished. Time: {time.time() - start}")
36
  return video_path
37
 
38
- def demo(input_text):
39
- base_path = "./results"
40
-
41
- if not os.path.exists(base_path):
42
- os.makedirs(base_path)
43
-
44
- config = {
45
- "devices": [0], # Используем CPU
46
- "base_path": base_path, # Указываем путь для сохранения видео
47
- "pipe_configs": {
48
- "prompts": [input_text]
49
- },
50
- "plugin_configs": {}
51
- }
52
- video_path = run_inference(input_text, config)
53
- return video_path
54
 
55
- iface = gr.Interface(fn=demo, inputs="text", outputs="video")
56
- iface.launch()
 
35
  print(f"Inference finished. Time: {time.time() - start}")
36
  return video_path
37
 
38
+ def demo_interface():
39
+ config_path = './configs/config.json'
40
+ with open(config_path, 'r') as f:
41
+ config = json.load(f)
42
+ iface = gr.Interface(
43
+ fn=lambda prompt: run_inference(prompt, config),
44
+ inputs="text",
45
+ outputs="text"
46
+ )
47
+ iface.launch()
 
 
 
 
 
 
48
 
49
+ if __name__ == "__main__":
50
+ demo_interface()