THED2 commited on
Commit
03487a3
·
verified ·
1 Parent(s): caef622

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -7,7 +7,7 @@ import subprocess
7
  from duckduckgo_search import DDGS
8
  from bs4 import BeautifulSoup
9
 
10
- # Gemini API Key -> Hugging Face Space ke Secrets mein 'GEMINI_API_KEY' naam se save karne ke liye
11
  GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
12
  GEMINI_URL = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key={GEMINI_API_KEY}"
13
 
@@ -29,7 +29,7 @@ def read_webpage(url: str) -> str:
29
  try:
30
  resp = requests.get(url, timeout=10, headers={"User-Agent": "Mozilla/5.0"})
31
  soup = BeautifulSoup(resp.text, 'html.parser')
32
- text = ' '.join(soup.stripped_strings)[:3000] # Token limit ke liye truncate
33
  return text
34
  except Exception as e:
35
  return f"Could not read webpage: {str(e)}"
@@ -163,7 +163,7 @@ def run_agent_loop(message, history=[]):
163
  "contents": contents,
164
  "tools": GEMINI_TOOLS,
165
  "systemInstruction": {
166
- "parts": [{"text": "You are a master developer agent embedded inside the environment. You can execute tools instantly to compile APK paths."}]
167
  }
168
  }
169
 
@@ -199,6 +199,6 @@ def run_agent_loop(message, history=[]):
199
  return f"Agent Logic Pipeline Error: {str(e)}"
200
 
201
  if __name__ == "__main__":
202
- print("Starting Setup directly on main port 7860...")
203
- # Command binary execution safe handle to prevent terminal halt
204
- subprocess.run("python3 -m antigravity --host 0.0.0.0 --port 7860 . || npx antigravity --port 7860 || tail -f /dev/null", shell=True)
 
7
  from duckduckgo_search import DDGS
8
  from bs4 import BeautifulSoup
9
 
10
+ # Gemini API Key -> Hugging Face Space ke Secrets mein 'GEMINI_API_KEY' naam se save karein
11
  GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
12
  GEMINI_URL = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key={GEMINI_API_KEY}"
13
 
 
29
  try:
30
  resp = requests.get(url, timeout=10, headers={"User-Agent": "Mozilla/5.0"})
31
  soup = BeautifulSoup(resp.text, 'html.parser')
32
+ text = ' '.join(soup.stripped_strings)[:3000]
33
  return text
34
  except Exception as e:
35
  return f"Could not read webpage: {str(e)}"
 
163
  "contents": contents,
164
  "tools": GEMINI_TOOLS,
165
  "systemInstruction": {
166
+ "parts": [{"text": "You are a master developer agent inside the environment. You can execute tools instantly to compile APK paths."}]
167
  }
168
  }
169
 
 
199
  return f"Agent Logic Pipeline Error: {str(e)}"
200
 
201
  if __name__ == "__main__":
202
+ print("Starting Antigravity Web Module on main port 7860...")
203
+ # Pure Python antigravity tool integration redirection
204
+ import antigravity