{"id":15164697,"url":"https://github.com/gali1/ollama-cli-or-webui","last_synced_at":"2026-02-24T10:04:50.182Z","repository":{"id":251586965,"uuid":"837846971","full_name":"gali1/ollama-cli-or-webui","owner":"gali1","description":"This project provides a dual-interface tool for generating text responses using large language models.","archived":false,"fork":false,"pushed_at":"2024-09-02T19:06:14.000Z","size":82,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-17T03:27:35.347Z","etag":null,"topics":["cli","command-line","flask","huggingface","huggingface-transformers","interface","interfaces","llama","llm","llm-inference","natural-language-processing","nlp","nlp-parsing","rest-api","service","text-generation","transformers","transformers-models","web"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gali1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-04T08:03:42.000Z","updated_at":"2024-09-02T19:06:17.000Z","dependencies_parsed_at":"2024-09-13T22:40:51.384Z","dependency_job_id":"9ea6a3b7-e568-4708-9f0d-b1d518322a88","html_url":"https://github.com/gali1/ollama-cli-or-webui","commit_stats":{"total_commits":34,"total_committers":1,"mean_commits":34.0,"dds":0.0,"last_synced_commit":"86fbb915431940a4c39ff26570d29ebfa71c430a"},"previous_names":["gali1/ollama-cli-or-webui"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gali1/ollama-cli-or-webui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gali1%2Follama-cli-or-webui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gali1%2Follama-cli-or-webui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gali1%2Follama-cli-or-webui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gali1%2Follama-cli-or-webui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gali1","download_url":"https://codeload.github.com/gali1/ollama-cli-or-webui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gali1%2Follama-cli-or-webui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29779262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","flask","huggingface","huggingface-transformers","interface","interfaces","llama","llm","llm-inference","natural-language-processing","nlp","nlp-parsing","rest-api","service","text-generation","transformers","transformers-models","web"],"created_at":"2024-09-27T03:43:25.660Z","updated_at":"2026-02-24T10:04:50.167Z","avatar_url":"https://github.com/gali1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n```markdown\n# Use LLM Using CLI or WEB-UI\n\n## Overview\n\nThis project provides two methods to generate text responses:\n- A Flask-based web service.\n- A CLI-based (non-Flask) application.\n\nBoth methods can use either the Transformers library with\nHugging Face models or Llama (via `llama_cpp`).\n\n## Prerequisites\n\n1. **Python 3.7 or higher**: Ensure that you have Python installed.\nDownload it from [python.org](https://www.python.org/downloads/).\n\n2. **Virtual Environment (recommended)**: It's recommended to create a\nvirtual environment to manage dependencies.\n\n3. **API Keys/Access**: Ensure you have the necessary\nAPI keys or access tokens for the Llama model if using it. (Optional)\n\n## Setup\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/gali1/ollama-cli-or-webui.git\ncd ollama-cli-or-webui\n```\n\n### 2. Create and Activate a Virtual Environment\n\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows use: venv\\Scripts\\activate\n```\n\n### 3. Install Dependencies\n\nCreate a `requirements.txt` file or use the following command to install the necessary packages:\n\n```bash\npip install flask python-dotenv transformers torch llama-cpp-python\n```\n\n### 4. Configure Environment Variables\n\nCreate a `.env` file in the project root directory and set the required environment variables. Example `.env` file:\n\n```\nMODEL_NAME=gpt2\nLLAMA_MODEL_PATH=/path/to/llama/model\nMAX_TOKENS=256\nTEMPERATURE=0.7\nTOP_P=0.95\nTOP_K=50\nREPETITION_PENALTY=1.2\nNO_REPEAT_NGRAM_SIZE=4\nNUM_BEAMS=1\nBATCH_SIZE=128\n```\n\n**Note:** Adjust `LLAMA_MODEL_PATH` to point to your Llama model. If using the Transformers model, `LLAMA_MODEL_PATH` is not needed.\n\n### 5. Ensure Model and Tokenizer Files\n\n- **Transformers**: Ensure you have internet access or the models are available locally.\n- **Llama**: Ensure the model file is available at the specified path.\n\n## Running the Application\n\n### 1. Launch the Flask Application\n\nTo start the Flask server, use:\n\n```bash\npython llama-direct-llm.py\n```\n\nReplace `llama-direct-llm.py` with the appropriate script name if necessary.\n\n### 2. Access the CLI Application\n\nTo interact via CLI, run:\n\n```bash\npython llama-direct-llm-c.py\n```\n\n**Example CLI Usage:**\n\n```bash\n\u003e provide java code that generates 10 random numbers.\n```\n\n**Example Response:**\n\n```bash\nimport java.util.Random;\n\npublic class Main {\n    public static void main(String[] args) {\n        Random rand = new Random();\n        for (int i = 0; i \u003c 10; i++) {\n            int randomNum = rand.nextInt((100 - 1) + 1) + 1;\n            System.out.println(\"Random number \" + (i + 1) + \" : \" + randomNum);\n        }\n    }\n}\n\n// Here we are creating a Java program that generates 10 random numbers between 1 and 100. \n// The \"rand.nextInt((100 - 1) + 1) + 1\" part of the code is used to generate the random numbers. \n// The numbers generated are from the range 1 to 100 (inclusive).\n// \"nextInt((100 - 1) + 1)\" generates a random number between 0 (inclusive) to 100 (inclusive). Adding 1 shifts that range to 1 to 100.\n```\n\n### 3. Access the Web Service\n\nBy default, the Flask app will run on `http://127.0.0.1:9898`. You can send a POST request to the `/generate` endpoint with a JSON payload:\n\n**Example Request:**\n\n```bash\ncurl -X POST http://127.0.0.1:9898/generate -H \"Content-Type: application/json\" -d '{\"prompt\": \"Tell me a joke.\"}'\n```\n\n**Example Response:**\n\n```json\n{\n  \"response\": \"Here is a joke: Why did the scarecrow win an award? Because he was outstanding in his field!\"\n}\n```\n\n## Troubleshooting\n\n- **Missing Environment Variables**: Ensure all required environment variables are set in the `.env` file.\n- **Model Loading Issues**: Verify model paths and configurations are correct.\n- **Dependency Issues**: Ensure all dependencies are installed and compatible with your Python version.\n\n---\nFeel free to reach out if you have any questions or run into issues. Happy coding!\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgali1%2Follama-cli-or-webui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgali1%2Follama-cli-or-webui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgali1%2Follama-cli-or-webui/lists"}