Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
-
|
4 |
-
from transformers import AutoModelForCausalLM
|
5 |
-
# Use a pipeline as a high-level helper
|
6 |
-
from transformers import pipeline
|
7 |
|
|
|
8 |
pipe = pipeline("visual-question-answering", model="openbmb/MiniCPM-Llama3-V-2_5", trust_remote_code=True)
|
9 |
|
|
|
10 |
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
|
|
|
11 |
"""
|
12 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
13 |
"""
|
14 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
15 |
|
16 |
-
|
17 |
def respond(
|
18 |
message,
|
19 |
history: list[tuple[str, str]],
|
@@ -54,7 +53,7 @@ demo = gr.ChatInterface(
|
|
54 |
additional_inputs=[
|
55 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
56 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
57 |
-
gr.Slider(minimum=0.1, maximum
|
58 |
gr.Slider(
|
59 |
minimum=0.1,
|
60 |
maximum=1.0,
|
@@ -65,6 +64,5 @@ demo = gr.ChatInterface(
|
|
65 |
],
|
66 |
)
|
67 |
|
68 |
-
|
69 |
if __name__ == "__main__":
|
70 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
from transformers import AutoModelForCausalLM, pipeline
|
|
|
|
|
|
|
4 |
|
5 |
+
# Use a pipeline as a high-level helper
|
6 |
pipe = pipeline("visual-question-answering", model="openbmb/MiniCPM-Llama3-V-2_5", trust_remote_code=True)
|
7 |
|
8 |
+
# Load model directly
|
9 |
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
|
10 |
+
|
11 |
"""
|
12 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
13 |
"""
|
14 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
15 |
|
|
|
16 |
def respond(
|
17 |
message,
|
18 |
history: list[tuple[str, str]],
|
|
|
53 |
additional_inputs=[
|
54 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
55 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
56 |
+
gr.Slider(minimum=0.1, maximum 4.0, value=0.7, step=0.1, label="Temperature"),
|
57 |
gr.Slider(
|
58 |
minimum=0.1,
|
59 |
maximum=1.0,
|
|
|
64 |
],
|
65 |
)
|
66 |
|
|
|
67 |
if __name__ == "__main__":
|
68 |
+
demo.launch()
|