Vitrous commited on
Commit
68aa8cc
1 Parent(s): be66b6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -6,6 +6,7 @@ import torch
6
  import optimum
7
  from transformers import (AutoModelForCausalLM, AutoTokenizer, LlamaForCausalLM, LlamaTokenizer, GenerationConfig, pipeline,)
8
  from fastapi.middleware.cors import CORSMiddleware
 
9
 
10
  os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'
11
  torch.cuda.empty_cache()
@@ -14,6 +15,10 @@ torch.cuda.set_per_process_memory_fraction(0.8) # Adjust the fraction as needed
14
  app = FastAPI(title="Deploying FastAPI Apps on Huggingface")
15
  app.add_middleware(CORSMiddleware, allow_origins=['*'], allow_methods=['*'], allow_headers=['*'],)
16
 
 
 
 
 
17
 
18
  # Load the model and tokenizer
19
  model_name_or_path = "TheBloke/Wizard-Vicuna-7B-Uncensored-GPTQ"
 
6
  import optimum
7
  from transformers import (AutoModelForCausalLM, AutoTokenizer, LlamaForCausalLM, LlamaTokenizer, GenerationConfig, pipeline,)
8
  from fastapi.middleware.cors import CORSMiddleware
9
+ from pyngrok import ngrok
10
 
11
  os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'
12
  torch.cuda.empty_cache()
 
15
  app = FastAPI(title="Deploying FastAPI Apps on Huggingface")
16
  app.add_middleware(CORSMiddleware, allow_origins=['*'], allow_methods=['*'], allow_headers=['*'],)
17
 
18
+ ngrok.set_auth_token("Your token here")
19
+ ngrok.kill()
20
+ ngrok_tunnel = ngrok.connect(7860)
21
+ print(ngrok_tunnel.public_url)
22
 
23
  # Load the model and tokenizer
24
  model_name_or_path = "TheBloke/Wizard-Vicuna-7B-Uncensored-GPTQ"