Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,13 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from huggingface_hub import list_models
|
| 3 |
|
|
|
|
|
|
|
| 4 |
def toggle_all(prompt):
|
| 5 |
# ここでタブの可視性を切り替えるロジックを追加
|
| 6 |
-
|
|
|
|
| 7 |
return gr.update(visible=True), answer
|
| 8 |
|
| 9 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
|
@@ -47,7 +51,7 @@ with gr.Blocks() as demo:
|
|
| 47 |
with gr.Column():
|
| 48 |
prompt = gr.Textbox(visible=True, label="プロンプト")
|
| 49 |
resp = gr.Textbox(visible=True, label="レスポンス")
|
| 50 |
-
show_button = gr.Button("
|
| 51 |
|
| 52 |
show_button.click(fn=toggle_all, inputs=prompt, outputs=[tab_llm, resp])
|
| 53 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import cohere
|
| 3 |
from huggingface_hub import list_models
|
| 4 |
|
| 5 |
+
co = cohere.ClientV2(api_key="GqsxZlKmcBzSultkVOfKPf7kVhYkporXvivq9KHg")
|
| 6 |
+
|
| 7 |
def toggle_all(prompt):
|
| 8 |
# ここでタブの可視性を切り替えるロジックを追加
|
| 9 |
+
response = co.chat(model="command-r-plus-08-2024", messages=messages)
|
| 10 |
+
answer = response.message.content[0].text
|
| 11 |
return gr.update(visible=True), answer
|
| 12 |
|
| 13 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
|
|
|
| 51 |
with gr.Column():
|
| 52 |
prompt = gr.Textbox(visible=True, label="プロンプト")
|
| 53 |
resp = gr.Textbox(visible=True, label="レスポンス")
|
| 54 |
+
show_button = gr.Button("生成")
|
| 55 |
|
| 56 |
show_button.click(fn=toggle_all, inputs=prompt, outputs=[tab_llm, resp])
|
| 57 |
|