dazzleun-7 commited on
Commit
c73b270
Β·
verified Β·
1 Parent(s): 9829399

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -190,6 +190,11 @@ class BERTDataset(Dataset):
190
  def __len__(self):
191
  return (len(self.labels))
192
 
 
 
 
 
 
193
  # Kobert_softmax
194
  class BERTClassifier(nn.Module):
195
  def __init__(self,
@@ -614,16 +619,16 @@ with gr.Blocks() as app:
614
  choices=[f"{k}. {v}" for k, v in options.items()],
615
  label="πŸ€– μ›ν•˜λŠ” 챗봇 μŠ€νƒ€μΌ 선택"
616
  )
617
- diary_input = gr.Textbox(label="πŸ“œ 였늘의 ν•˜λ£¨ κΈ°λ‘ν•˜κΈ°", placeholder="ex)였늘 μ†Œν’κ°€μ„œ λ§›μžˆλŠ” κ±Έ 많이 λ¨Ήμ–΄μ„œ μ—„μ²­ 신났어")
618
- image_input = gr.Image(type="pil", label="πŸ“· μ–Όκ΅΄ ν‘œμ • 사진 μ—…λ‘œλ“œ")
619
  playlist_input = gr.Radio(["λΉ„μŠ·ν•œ", "μƒλ°˜λœ"], label="🎧 였늘의 감정과 γ…‡γ…‡λ˜λŠ” ν”Œλ ˆμ΄λ¦¬μŠ€νŠΈ μΆ”μ²œ λ°›κΈ°")
 
 
620
  submit_btn = gr.Button("πŸš€ 뢄석 μ‹œμž‘")
621
 
622
  with gr.Column():
623
  output_playlist = gr.Dataframe(label="🎧 μΆ”μ²œ ν”Œλ ˆμ΄λ¦¬μŠ€νŠΈ ")
624
  output_comment = gr.Textbox(label="πŸ’¬ AI μ½”λ©˜νŠΈ")
625
  output_topics = gr.Textbox(label="πŸ“ μΆ”μ²œ 일기 μ½˜ν…μΈ ")
626
- output_image = gr.Image(label="πŸ–ΌοΈ μƒμ„±λœ 였늘의 감정 캐릭터", type="pil", width=512, height=512)
627
 
628
  # λ²„νŠΌ 클릭 이벀트 μ—°κ²°
629
  submit_btn.click(
 
190
  def __len__(self):
191
  return (len(self.labels))
192
 
193
+
194
+ tokenizer = KoBERTTokenizer.from_pretrained('skt/kobert-base-v1')
195
+ bertmodel = BertModel.from_pretrained('skt/kobert-base-v1', return_dict=False)
196
+ vocab = nlp.vocab.BERTVocab.from_sentencepiece(tokenizer.vocab_file, padding_token='[PAD]')
197
+
198
  # Kobert_softmax
199
  class BERTClassifier(nn.Module):
200
  def __init__(self,
 
619
  choices=[f"{k}. {v}" for k, v in options.items()],
620
  label="πŸ€– μ›ν•˜λŠ” 챗봇 μŠ€νƒ€μΌ 선택"
621
  )
 
 
622
  playlist_input = gr.Radio(["λΉ„μŠ·ν•œ", "μƒλ°˜λœ"], label="🎧 였늘의 감정과 γ…‡γ…‡λ˜λŠ” ν”Œλ ˆμ΄λ¦¬μŠ€νŠΈ μΆ”μ²œ λ°›κΈ°")
623
+ diary_input = gr.Textbox(label="πŸ“œ 였늘의 ν•˜λ£¨ κΈ°λ‘ν•˜κΈ°", placeholder="ex)였늘 μ†Œν’κ°€μ„œ λ§›μžˆλŠ” κ±Έ 많이 λ¨Ήμ–΄μ„œ μ—„μ²­ 신났어")
624
+ image_input = gr.Image(type="pil", label="πŸ“· μ–Όκ΅΄ ν‘œμ • 사진 μ—…λ‘œλ“œ", width=256, height=256)
625
  submit_btn = gr.Button("πŸš€ 뢄석 μ‹œμž‘")
626
 
627
  with gr.Column():
628
  output_playlist = gr.Dataframe(label="🎧 μΆ”μ²œ ν”Œλ ˆμ΄λ¦¬μŠ€νŠΈ ")
629
  output_comment = gr.Textbox(label="πŸ’¬ AI μ½”λ©˜νŠΈ")
630
  output_topics = gr.Textbox(label="πŸ“ μΆ”μ²œ 일기 μ½˜ν…μΈ ")
631
+ output_image = gr.Image(label="πŸ–ΌοΈ μƒμ„±λœ 였늘의 감정 캐릭터", type="pil", width=256, height=256)
632
 
633
  # λ²„νŠΌ 클릭 이벀트 μ—°κ²°
634
  submit_btn.click(