ll7098ll commited on
Commit
6ab5f49
·
verified ·
1 Parent(s): 7967c58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -48,9 +48,17 @@ def generate_school_plan(subject_name, integrated_subjects, grade, semester, hou
48
  ]
49
  )
50
 
51
- for chunk in response.text.split('\n'):
52
- yield chunk + '\n'
53
- time.sleep(0.05)
 
 
 
 
 
 
 
 
54
 
55
  iface = gr.Interface(
56
  fn=generate_school_plan,
 
48
  ]
49
  )
50
 
51
+ full_text = ""
52
+ yield full_text # 초기 빈 텍스트 출력
53
+
54
+ try:
55
+ response = model.generate_content(prompt_parts, stream=True)
56
+ for chunk in response:
57
+ full_text += chunk.text
58
+ yield full_text
59
+ time.sleep(0.05) # 약간의 지연 추가
60
+ except Exception as e:
61
+ yield f"에러 발생: {str(e)}"
62
 
63
  iface = gr.Interface(
64
  fn=generate_school_plan,