Update app.py
Browse files123456789101112131436 unmodified lines5152535455565746 unmodified lines104105106107108109110111import gradio as grimport spacesimport transformers_gradiofrom functools import lru_cache# Cache model loading to optimize performance@lru_cache(maxsize=3)def load_hf_model(model_name):return gr.load(name=f"deepseek-ai/{model_name}",src=transformers_gradio.registry,api_name="/chat")36 unmodified lines"""# DeepSeek ChatbotCreated by [ruslanmv.com](https://ruslanmv.com/)This is a demo of different DeepSeek models. Select a model, type your message, and click "Submit".You can also adjust optional parameters like system message, max new tokens, temperature, and top-p."""46 unmodified lines# Add GPU support for Hugging Face Spacesdemo.fn = spaces.GPU()(demo.fn)for fn in demo.fns.values():fn.api_name = Falseif __name__ == "__main__":demo.launch()123456789101112131436 unmodified lines51525354555646 unmodified lines103104105106107108109110import gradio as grimport spacesfrom functools import lru_cache# Cache model loading to optimize performance@lru_cache(maxsize=3)def load_hf_model(model_name):# Use the Gradio-built huggingface loader instead of transformers_gradioreturn gr.load(name=f"deepseek-ai/{model_name}",src="huggingface", # Changed from transformers_gradio.registryapi_name="/chat")36 unmodified lines"""# DeepSeek ChatbotCreated by [ruslanmv.com](https://ruslanmv.com/)This is a demo of different DeepSeek models. Select a model, type your message, and click "Submit".You can also adjust optional parameters like system message, max new tokens, temperature, and top-p."""46 unmodified lines# Add GPU support for Hugging Face Spacesdemo.fn = spaces.GPU()(demo.fn)for fn in demo.fns.values():fn.api_name = Falseif __name__ == "__main__":demo.launch()
app.py+4-5