Jalle007 commited on
Commit
a364dff
1 Parent(s): f987717
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. api_client.py +19 -0
  3. app.py +1 -1
  4. stopwatch.py +17 -0
.gitattributes CHANGED
@@ -1,3 +1,4 @@
 
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
  *.bin filter=lfs diff=lfs merge=lfs -text
 
1
+ env/
2
  *.7z filter=lfs diff=lfs merge=lfs -text
3
  *.arrow filter=lfs diff=lfs merge=lfs -text
4
  *.bin filter=lfs diff=lfs merge=lfs -text
api_client.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from gradio_client import Client
2
+ from stopwatch import Stopwatch
3
+
4
+ stopwatch = Stopwatch()
5
+ stopwatch.start()
6
+
7
+ q="\nRespond with city name only: What is the capital of Greece? "
8
+ print(q)
9
+ print("Sending request...")
10
+
11
+ client = Client("https://jalle007-vicuna.hf.space/")
12
+ result = client.predict(
13
+ q,
14
+ api_name="/predict"
15
+ )
16
+
17
+ stopwatch.stop()
18
+ print("Time: ", round(stopwatch.elapsed_time()), "s")
19
+ print(result)
app.py CHANGED
@@ -57,4 +57,4 @@ gradio_interface = gr.Interface(
57
  examples=examples,
58
  title="Vicuna-7B",
59
  )
60
- gradio_interface.launch()
 
57
  examples=examples,
58
  title="Vicuna-7B",
59
  )
60
+ gradio_interface.launch(share=True)
stopwatch.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+
3
+ class Stopwatch:
4
+ def __init__(self):
5
+ self.start_time = None
6
+ self.end_time = None
7
+
8
+ def start(self):
9
+ self.start_time = time.time()
10
+
11
+ def stop(self):
12
+ self.end_time = time.time()
13
+
14
+ def elapsed_time(self):
15
+ if self.start_time and self.end_time:
16
+ return self.end_time - self.start_time
17
+ return None