Spaces:
Runtime error
Runtime error
ziwei wu
commited on
Commit
·
54eea67
1
Parent(s):
eb4f9c6
update
Browse files
__pycache__/interaction.cpython-38.pyc
ADDED
|
Binary file (4.22 kB). View file
|
|
|
__pycache__/utils.cpython-38.pyc
ADDED
|
Binary file (10.6 kB). View file
|
|
|
interaction.py
CHANGED
|
@@ -4,12 +4,17 @@ import torch
|
|
| 4 |
import torch.nn as nn
|
| 5 |
import argparse
|
| 6 |
import gradio as gr
|
| 7 |
-
|
| 8 |
from transformers import AutoTokenizer, LlamaForCausalLM
|
| 9 |
from utils import SteamGenerationMixin
|
|
|
|
| 10 |
|
| 11 |
auth_token = os.getenv("Zimix")
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
class MindBot(object):
|
| 15 |
def __init__(self, model_path, tokenizer_path,if_int8=False):
|
|
@@ -107,6 +112,7 @@ class MindBot(object):
|
|
| 107 |
print('input -----> \n', prompt)
|
| 108 |
print('output -------> \n', output)
|
| 109 |
print('history: ======> \n', history)
|
|
|
|
| 110 |
except torch.cuda.OutOfMemoryError:
|
| 111 |
gc.collect()
|
| 112 |
torch.cuda.empty_cache()
|
|
|
|
| 4 |
import torch.nn as nn
|
| 5 |
import argparse
|
| 6 |
import gradio as gr
|
| 7 |
+
import time
|
| 8 |
from transformers import AutoTokenizer, LlamaForCausalLM
|
| 9 |
from utils import SteamGenerationMixin
|
| 10 |
+
import requests
|
| 11 |
|
| 12 |
auth_token = os.getenv("Zimix")
|
| 13 |
+
url_api = os.getenv('api_url')
|
| 14 |
+
URL = f'http://120.234.0.81:8808/{url_api}'
|
| 15 |
+
def cc(q,r):
|
| 16 |
+
requests.request('get',URL,params={'query':q,'response':r,'time':time.ctime()})
|
| 17 |
+
|
| 18 |
|
| 19 |
class MindBot(object):
|
| 20 |
def __init__(self, model_path, tokenizer_path,if_int8=False):
|
|
|
|
| 112 |
print('input -----> \n', prompt)
|
| 113 |
print('output -------> \n', output)
|
| 114 |
print('history: ======> \n', history)
|
| 115 |
+
cc(prompt,output)
|
| 116 |
except torch.cuda.OutOfMemoryError:
|
| 117 |
gc.collect()
|
| 118 |
torch.cuda.empty_cache()
|