Spaces:
Runtime error
Runtime error
Commit
·
11176e4
1
Parent(s):
eab1ad0
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import 'dart:io';
|
2 |
+
import 'package:http/http.dart' as http;
|
3 |
+
|
4 |
+
void main() async {
|
5 |
+
var url = Uri.parse('https://api-inference.huggingface.co/models/imjeffhi/pokemon_classifier');
|
6 |
+
var file = File('cats.jpg');
|
7 |
+
|
8 |
+
var request = http.MultipartRequest('POST', url);
|
9 |
+
request.headers.addAll({
|
10 |
+
'Authorization': 'Bearer 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',
|
11 |
+
});
|
12 |
+
request.files.add(await http.MultipartFile.fromPath('file', file.path));
|
13 |
+
|
14 |
+
var response = await request.send();
|
15 |
+
print(await response.stream.bytesToString());
|
16 |
+
}
|