openfree commited on
Commit
6b749d2
Β·
verified Β·
1 Parent(s): 9eabde1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -34,24 +34,27 @@ def transcribe_summarize_and_blog(inputs, task):
34
  # λ³€ν™˜λœ ν…μŠ€νŠΈ μš”μ•½ μš”μ²­
35
  try:
36
  summary = hf_client.summarization(text)
 
37
  except Exception as e:
38
  raise gr.Error(f"μš”μ•½ 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {e}")
39
-
40
- # λΈ”λ‘œκ·Έ ν¬μŠ€νŒ… 생성 μš”μ²­
41
  try:
42
  blog_post = hf_client.text_generation(
43
  prompt=f"λ‹€μŒ λ‚΄μš©μ„ 기반으둜 λΈ”λ‘œκ·Έ ν¬μŠ€νŒ…μ„ μž‘μ„±ν•΄ μ£Όμ„Έμš”:\n{text}",
44
  temperature=0.7
45
  )
 
46
  except Exception as e:
47
  raise gr.Error(f"λΈ”λ‘œκ·Έ κΈ€ 생성 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {e}")
48
 
49
  return {
50
  "transcribed_text": text,
51
- "summary": summary["summary_text"],
52
- "blog_post": blog_post # λ”•μ…”λ„ˆλ¦¬κ°€ μ•„λ‹Œ λ¬Έμžμ—΄λ‘œ λ°˜ν™˜λ˜λ―€λ‘œ λ°”λ‘œ μ‚¬μš©
53
  }
54
 
 
55
 
56
  css = """
57
  footer {
 
34
  # λ³€ν™˜λœ ν…μŠ€νŠΈ μš”μ•½ μš”μ²­
35
  try:
36
  summary = hf_client.summarization(text)
37
+ summary_text = summary["summary_text"] if summary and "summary_text" in summary else "μš”μ•½ν•  수 μ—†μŠ΅λ‹ˆλ‹€."
38
  except Exception as e:
39
  raise gr.Error(f"μš”μ•½ 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {e}")
40
+
41
+ # λΈ”λ‘œκ·Έ ν¬μŠ€νŒ… 생성 μš”μ²­
42
  try:
43
  blog_post = hf_client.text_generation(
44
  prompt=f"λ‹€μŒ λ‚΄μš©μ„ 기반으둜 λΈ”λ‘œκ·Έ ν¬μŠ€νŒ…μ„ μž‘μ„±ν•΄ μ£Όμ„Έμš”:\n{text}",
45
  temperature=0.7
46
  )
47
+ blog_post_text = blog_post if isinstance(blog_post, str) else "λΈ”λ‘œκ·Έ ν¬μŠ€νŒ…μ„ 생성할 수 μ—†μŠ΅λ‹ˆλ‹€."
48
  except Exception as e:
49
  raise gr.Error(f"λΈ”λ‘œκ·Έ κΈ€ 생성 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {e}")
50
 
51
  return {
52
  "transcribed_text": text,
53
+ "summary": summary_text,
54
+ "blog_post": blog_post_text
55
  }
56
 
57
+
58
 
59
  css = """
60
  footer {