Spaces:
Sleeping
Sleeping
File size: 2,077 Bytes
941ffa1 77d76dd 6f3ad16 41fa829 77d76dd 6f3ad16 77d76dd f104694 6f3ad16 41fa829 e976d8b 6f3ad16 41fa829 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 17be31f 6f3ad16 41fa829 17be31f 6f3ad16 41fa829 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
import gradio as gr
from llama_cpp import Llama
# Load the model
llm = Llama.from_pretrained(
repo_id="uonlp/Vistral-7B-Chat-gguf",
filename="ggml-vistral-7B-chat-f16.gguf"
)
# Define the function to interact with the model
def chat_with_model(user_input):
response = llm.create_chat_completion(
messages=[{"role": "user", "content": user_input}]
)
return response['choices'][0]['message']['content']
# Define CSS for patient-friendly appearance
custom_css = """
body {
background-color: #f0f9ff; /* Softer light blue background */
font-family: 'Arial', sans-serif;
}
.gradio-container {
border: 2px solid #b3e0ff;
border-radius: 15px;
padding: 30px;
background-color: #ffffff;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}
h1 {
color: #4a90e2;
text-align: center;
font-size: 28px;
}
p {
font-size: 18px;
color: #333333;
text-align: center;
}
input, textarea {
border: 2px solid #b3d9ff;
border-radius: 10px;
padding: 15px;
width: 100%;
font-size: 18px;
}
.gr-button {
background-color: #4da6ff;
border: none;
border-radius: 10px;
color: white;
padding: 15px 25px;
font-size: 18px;
cursor: pointer;
margin-top: 20px;
display: block;
width: 100%;
}
.gr-button:hover {
background-color: #3399ff;
}
.gradio-container:before {
content: "💬 How can we help you today?";
display: block;
text-align: center;
font-size: 24px;
color: #2c6693;
margin-bottom: 20px;
}
"""
# Create the Gradio interface
iface = gr.Interface(
fn=chat_with_model,
inputs="text",
outputs="text",
title="Friendly Medical Chatbot",
description="Feel free to ask any questions. We’re here to help!",
theme="default",
css=custom_css
)
# Launch the interface
if __name__ == "__main__":
iface.launch()
|