1- import React from " react" ;
1+ import React from ' react' ;
22import {
33 StyleSheet ,
44 Text ,
55 Button ,
66 TextInput ,
77 SafeAreaView ,
8- } from " react-native" ;
9- import * as FileSystem from " expo-file-system" ;
10- import { Pipeline } from " react-native-transformers" ;
11- import presets from " ./presets.json" ;
8+ } from ' react-native' ;
9+ import * as FileSystem from ' expo-file-system' ;
10+ import { Pipeline } from ' react-native-transformers' ;
11+ import presets from ' ./presets.json' ;
1212
1313export default function App ( ) {
1414 const [ progress , setProgress ] = React . useState < number > ( ) ;
15- const [ input , setInput ] = React . useState < string > ( " We love local LLM" ) ;
15+ const [ input , setInput ] = React . useState < string > ( ' We love local LLM' ) ;
1616 const [ output , setOutput ] = React . useState < string > ( ) ;
1717
1818 const loadModel = async ( preset : {
@@ -21,23 +21,23 @@ export default function App() {
2121 onnx_path : string ;
2222 options ?: any ;
2323 } ) => {
24- console . log ( " loading" ) ;
24+ console . log ( ' loading' ) ;
2525 await Pipeline . TextGeneration . init ( preset . model , preset . onnx_path , {
2626 verbose : true ,
2727 fetch : async ( url ) => {
2828 try {
29- console . log ( " Checking file... " + url ) ;
30- const fileName = url . split ( "/" ) . pop ( ) ! ;
29+ console . log ( ' Checking file... ' + url ) ;
30+ const fileName = url . split ( '/' ) . pop ( ) ! ;
3131 const localPath = FileSystem . documentDirectory + fileName ;
32-
32+
3333 // Check if the file already exists
3434 const fileInfo = await FileSystem . getInfoAsync ( localPath ) ;
3535 if ( fileInfo . exists ) {
36- console . log ( " File already exists: " + localPath ) ;
36+ console . log ( ' File already exists: ' + localPath ) ;
3737 return localPath ;
3838 }
39-
40- console . log ( " Downloading... " + url ) ;
39+
40+ console . log ( ' Downloading... ' + url ) ;
4141 const downloadResumable = FileSystem . createDownloadResumable (
4242 url ,
4343 localPath ,
@@ -46,22 +46,22 @@ export default function App() {
4646 setProgress ( totalBytesWritten / totalBytesExpectedToWrite ) ;
4747 }
4848 ) ;
49-
49+
5050 const result = await downloadResumable . downloadAsync ( ) ;
5151 if ( ! result ) {
52- throw new Error ( " Download failed." ) ;
52+ throw new Error ( ' Download failed.' ) ;
5353 }
54-
55- console . log ( " Downloaded to: " + result . uri ) ;
54+
55+ console . log ( ' Downloaded to: ' + result . uri ) ;
5656 return result . uri ;
5757 } catch ( error ) {
58- console . error ( " Download error:" , error ) ;
58+ console . error ( ' Download error:' , error ) ;
5959 return null ;
6060 }
6161 } ,
6262 ...preset . options ,
6363 } ) ;
64- console . log ( " loaded" ) ;
64+ console . log ( ' loaded' ) ;
6565 } ;
6666
6767 const AutoComplete = ( ) => {
@@ -92,11 +92,11 @@ export default function App() {
9292const styles = StyleSheet . create ( {
9393 container : {
9494 flex : 1 ,
95- alignItems : " center" ,
96- justifyContent : " center" ,
95+ alignItems : ' center' ,
96+ justifyContent : ' center' ,
9797 } ,
9898 input : {
9999 borderWidth : 1 ,
100- borderColor : " black" ,
100+ borderColor : ' black' ,
101101 } ,
102102} ) ;
0 commit comments