Spaces:
No application file
No application file
Download Dockerfile from codex-automatus/g: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/codex-automatus/g/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/codex-automatus/g/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/codex-automatus/g/resolve/main/Dockerfile
1.3 kB
| import gradio as gr | |
| from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline | |
| import torch | |
| import os | |
| model_name = "gijl/gemma-4-E2B-it" | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| model = AutoModelForCausalLM.from_pretrained(model_name, | |
| torch_dtype=torch.float16, | |
| device_map="auto") | |
| pipe = pipeline("text-generation", | |
| model=model_name, | |
| tokenizer=tokenizer, | |
| max_new_tokens=150, | |
| temperature=0.7) | |
| def generate_response(message, history): | |
| messages = [ | |
| [ | |
| { | |
| "role": "system", | |
| "content": [{"type": "text", | |
| "text": "You are a brain map model, an outstanding medical assistant, and a talented university professor. "},] | |
| }, | |
| { | |
| "role": "user", | |
| "content": [{"type": "text", | |
| "text": message},] | |
| }, | |
| ], | |
| ] | |
| response = pipe(messages) | |
| return response[0][0]['generated_text'][2]['content'] | |
| demo = gr.ChatInterface( | |
| generate_response, | |
| title="Brain map(com LLM)", | |
| description="You are a Gemma 4 model, a trusted speaker and medical assistant. " | |
| ) | |
| demo.launch() |