Sreekan commited on
Commit
d7f529a
·
verified ·
1 Parent(s): 70059f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import gradio as gr
2
  import os
3
  if os.environ.get("SPACES_ZERO_GPU") is not None:
@@ -43,7 +45,6 @@ demo.launch()
43
 
44
 
45
 
46
- '''
47
 
48
  import gradio as gr
49
  from huggingface_hub import InferenceClient
@@ -376,6 +377,8 @@ try:
376
  except Exception as e:
377
  print(f"[ERROR] Workflow execution failed: {e}")
378
 
 
 
379
  from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
380
  from langchain_huggingface import HuggingFacePipeline
381
  from langchain.tools import Tool
@@ -383,6 +386,20 @@ from langchain.agents import create_react_agent
383
  from langgraph.graph import StateGraph, END
384
  from pydantic import BaseModel
385
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
 
387
  # ---------------------------------------
388
  # Step 1: Define Hugging Face LLM (Qwen/Qwen2.5-7B-Instruct-1M)
@@ -603,5 +620,3 @@ iface = gr.Interface(
603
  if __name__ == "__main__":
604
  iface.launch()
605
 
606
-
607
- '''
 
1
+ '''
2
+
3
  import gradio as gr
4
  import os
5
  if os.environ.get("SPACES_ZERO_GPU") is not None:
 
45
 
46
 
47
 
 
48
 
49
  import gradio as gr
50
  from huggingface_hub import InferenceClient
 
377
  except Exception as e:
378
  print(f"[ERROR] Workflow execution failed: {e}")
379
 
380
+ '''
381
+
382
  from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
383
  from langchain_huggingface import HuggingFacePipeline
384
  from langchain.tools import Tool
 
386
  from langgraph.graph import StateGraph, END
387
  from pydantic import BaseModel
388
  import gradio as gr
389
+ import os
390
+ if os.environ.get("SPACES_ZERO_GPU") is not None:
391
+ import spaces
392
+ else:
393
+ class spaces:
394
+ @staticmethod
395
+ def GPU(func):
396
+ def wrapper(*args, **kwargs):
397
+ return func(*args, **kwargs)
398
+ return wrapper
399
+
400
+ @spaces.GPU
401
+ def fake_gpu():
402
+ pass
403
 
404
  # ---------------------------------------
405
  # Step 1: Define Hugging Face LLM (Qwen/Qwen2.5-7B-Instruct-1M)
 
620
  if __name__ == "__main__":
621
  iface.launch()
622