Spaces:
Sleeping
Sleeping
Upload 4 files
Browse filesFiles changed (5)
- .gitattributes+1
- DockerfileAdded+14
- app.pyAdded+39
- templates/TaskBot logo.pngAdded
- templates/index.htmlAdded
32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -texttemplates/TaskBot[[:space:]]logo.png filter=lfs diff=lfs merge=lfs -text1234567891011121314FROM python:3.9
WORKDIR /app
COPY . /app
RUN pip install --no-cache-dir -r requirements.txt
ENV HF_HOME=/app/hf_cache
ENV TRANSFORMERS_CACHE=/app/hf_cache
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
EXPOSE 7860
# Run Gunicorn with 4 worker processes on port 7860
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"]123456789101112131415161718192021222324252627282930313233343536373839#Downloading and importing all the modules required for this TaskBot v1 AI
import google.generativeai as genai
import os
import json
import requests
from flask import Flask, request, jsonify, render_template
import torch
#Connect to index.html
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/ask", methods=["POST"])
def ask():
#getting the question from the form
question = request.form.get("question", "").strip()
if not question:
return jsonify({"error": "Please provide a question."}), 400
genai.configure(api_key="AIzaSyA5FFcaVCfVmwf7X5C59n4xWc96xWR-A_4")
try:
# use Google's Gemini-2.0-Flash nodle for generating content
model = genai.GenerativeModel('gemini-2.0-flash')
response = model.generate_content(f"You are TaskBot AI created and trained by Advay Singh and Astrumix. Remember that and just anser me this question in detail- {question}. And don't reply on that message. Just answer me the question.")
answer = response.text
# Log the question and answer for debugging
print(f"Question: {question}\n------------------------- \n {answer} \n -------------------------")
# Return the answer as JSON
return jsonify({"answer": answer})
except Exception as e:
print(f"Error: {e}")
return jsonify({"error": "An error occurred while processing your request."}), 500
if __name__ == "__main__":
app.run(port=5000, host="0.0.0.0").gitattributes+1
DockerfileAdded+14
app.pyAdded+39
templates/TaskBot logo.pngAdded

Large File Pointer Details
- SHA256: 08e6f2547b25cd10af6e984b14fd6c85dd4e466fe80e27c214edf11e39d3e1e7
- Pointer size: 131 Bytes
- Size of remote file: 118 kB
templates/index.htmlAdded