Fix: Resolve runtime errors and Add: MCP support

#2

The Space was previously failing to run due to gradio issues and incorrect hardware requests. This commit resolves these runtime errors and improves code quality, making the application fully functional and MCP Compatible.

  • Authentication Fix: The user-facing token input, which was causing errors, has been removed. The application now correctly authenticates by reading the HF_TOKEN from the Space's secrets.
  • GPU Enablement: Added the @spaces.GPU() decorator to the main processing functions. This ensures the Space requests and utilizes the necessary GPU hardware, fixing a key execution failure.
  • Dependency Update: Corrected the Gradio SDK version in README.md to 5.38.2.
  • UI Update: The description text in the UI has been updated to reflect the new, functional authentication method.
  • MCP Compatibility & Documentation: Added mcp_server=True to the launch() method and populated all functions with comprehensive docstrings.
atalaydenknalbant changed pull request status to open

Morning @colbyford , to make the Space work you need to add your HF_TOKEN to the environment secrets.

Also, since you have a Hugging Face Pro account, you can use Zero-GPU hardware on your Spaces free of charge.


๐Ÿš€ How to Add Your Hugging Face Token

To make the Space fully operational, you need to provide your Hugging Face token as a secret. This allows the application to access the required models securely without asking every user for their credentials.

Here are the steps:

  1. In your Space repository on the Hugging Face website, navigate to the Settings tab.
  2. Scroll down to the Variables and secrets section and click the New secret button.
  3. A form will pop up. You must fill it out exactly as described below:
    • Name: HF_TOKEN
    • Value: Paste your personal Hugging Face access token here. (You can find or create one in your main Hugging Face profile settings. It will start with hf_...)
  4. Click Save. After saving, you may need to restart the Space from the "Manage" menu (the three dots) for the changes to apply.

Here is a visual guide for the "New secret" form:
image.png

atalaydenknalbant changed pull request title from Fix: Resolve runtime errors by enabling GPU, refactoring auth and updating gradio to Fix: Resolve runtime errors and Add: MCP support
Cannot merge
This branch has merge conflicts in the following files:
  • app.py

Sign up or log in to comment